package com.zyw.apple;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zhangyw
 * @version 17/3/9 21:51
 */
@Service
@Transactional(readOnly = true)
public class AppleService {

    @Autowired
    private AppleDao appleDao;

    @Transactional(readOnly = false)
    public void biz1(Apple apple) {
        this.appleDao.insert(apple);
        List<Apple> appleList = this.appleDao.findAll();

        System.out.println(JSON.toJSONString(appleList));
    }
}
